Avoid using syscall for errors on unix#201
Conversation
| //go:build !unix | ||
| // +build !unix | ||
|
|
||
| package fsutil |
There was a problem hiding this comment.
Wondering if these should live in an internal package, as (I think) we don't want consumers to be using these to match against (they're only do prevent having to split out the implementation further, correct?)
There was a problem hiding this comment.
What's the point of returning typed errors if we don't want consumers to match against them?
I don't really see an issue with old code as well, but if we define these separately, then we should export them as well to let consumers know what they can match against.
syscall is deprecated and non updated library whcih should be replaced by new one with name x/sys. Anyway, it may work on some platform and some errors migth be missed on some. A good example is OpenBSD which has lack of syscall.EBADMSG on amd64 and 386 but has on arm64. Here I moved all errors to two files: one for unix which uses sys.unix, and one for everything else which uses syscall as fallback.
|
@crazy-max here it is. I haven't tried to build it on go-1.22 but conflict was trivial and grep by patterns |
actually we could just play with build tags for this instead
syscall is deprecated and non updated library whcih should be replaced by new one with name x/sys.
Anyway, it may work on some platform and some errors migth be missed on some. A good example is OpenBSD which has lack of syscall.EBADMSG on amd64 and 386 but has on arm64.
Here I moved all errors to two files: one for unix which uses sys.unix, and one for everything else which uses syscall as fallback.